package com.example.smartcommunity;

import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageButton;
import android.widget.TextView;

import com.example.smartcommunity.com.example.utils.SpUtils;

public class NicknameActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_nickname);

        TextView tv_quxiao = findViewById(R.id.tv_quxiao);
        TextView tv_wancheng = findViewById(R.id.wancheng);
        final EditText et_name = findViewById(R.id.et_name);
        ImageButton img = findViewById(R.id.img);
        et_name.setText(SpUtils.getString(getApplicationContext() , "name" , "你看起来很可爱"));

        tv_quxiao.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
            }
        });
        tv_wancheng.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                SpUtils.setString(getApplicationContext() , "name" , et_name.getText()+"");
                finish();
            }
        });
        img.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                et_name.setText("");
            }
        });
    }
}
